﻿using Admin.ApplicationLib.Entities;
using Admin.CommonLib.Models.User;
using AutoMapper;

namespace Admin.WebApi.Mappers
{
    public class UserProfile : Profile
    {
        public UserProfile()
        {
            CreateMap<UserEntity, UserInfoResponseDto>()
                .ForMember(desc => desc.Key, opt => opt.MapFrom(src => src.Id))
                .ForMember(desc => desc.Phone, opt => opt.MapFrom(src => src.PhoneNumber));

            CreateMap<UserEditRequestDto, UserEntity>()
                .ForMember(desc => desc.PhoneNumber, opt => opt.MapFrom(src => src.Phone));


            CreateMap<UserTemplateResponseDto, UserEntity>();
        }
    }
}